package com.hbusa.cotroller.type;

import com.hbusa.dto.TbCategory;
import com.hbusa.service.CategoryService;
import com.hbusa.service.service.impl.CategoryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet("/doCategoryFindById")
public class findById extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String cat_id = req.getParameter("cat_id");
        String cat_name = req.getParameter("cat_name");

        System.out.println(cat_id);
        System.out.println(cat_name);

        CategoryService categoryService = new CategoryServiceImpl();

        TbCategory category1 = categoryService.doFindById(Long.parseLong(cat_id));

        System.out.println(category1);

        resp.sendRedirect("/index.html");

    }
}
